package com.ezjie.ielts.module_read.adapter;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.ezjie.ielts.R;
import com.ezjie.ielts.util.KeyValuePair;

public class SingleDialogAdapter extends BaseAdapter {

	private ArrayList<KeyValuePair<String, Boolean>> list = new ArrayList<KeyValuePair<String, Boolean>>();
	private Context mContext;

	public SingleDialogAdapter(Context context, ArrayList<KeyValuePair<String, Boolean>> list) {
		this.list = list;
		this.mContext = context;
	}

	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public KeyValuePair<String, Boolean> getItem(int position) {
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		if (null == convertView) {
			convertView = LayoutInflater.from(mContext).inflate(R.layout.layout_single_dialog_item, parent, false);
		}
		TextView content = (TextView) convertView.findViewById(R.id.tv_single_dialog_item);
		content.setText(list.get(position).first);
		return convertView;
	}
}